<?php
/**
 * Created by PhpStorm.
 * User: MrHung
 * Date: 8/13/14
 * Time: 2:42 PM
 */
session_start();
error_reporting(0);
if (
    isset ( $_POST['href'] )
    && isset ( $_POST['image'] )
    && isset ( $_POST['id'] )
) {
    $post['id'] = is_numeric($_POST['id']) ? $_POST['id'] : die();
    $post['link'] = trim( $_POST['href'] );
    $post['image'] = trim( $_POST['image'] );
    $post['position'] = trim( $_POST['position'] );


    //<---  * REQUIRE * ----->
    require_once('../../class_ajax_request/classAjaxAdmin.php');
    include_once('../../application/functions.php');
    include_once('../../application/DataConfig.php');

    //INSTANCE
    $obj = new AjaxRequestAdmin();

    //UPDATE BD
    $res = $obj->editAds($post);

    if( $res == 1 ) {
        $response = array(
            'success'=>true,
            'message'=>'Edit category success!'
        );
    } else{
        $response = array(
            'success'=>false,
            'message'=>'Edit category fail!'
        );
    }
    echo json_encode($response);die;

}// END IF SESSION ACTIVE